/***
 *@name 栈 后进先出
 *@author Administrator
 *@date 2022/1/9 21:21
 *@Description
 **/
class Stack {
    stack = {};
    length = 0;

    push(value) {
        this.stack[this.length] = value;
        this.length++;
    }

    pop() {
        const value = this.stack[this.length - 1];
        delete this.stack[this.length - 1];
        this.length--;
        return value;
    }

    peek() {
        return this.stack[this.length - 1];
    }
}

const statc = new Stack();
statc.push('111111');
statc.push('222222');
console.log(statc.stack)
statc.pop();
const data = statc.peek();
console.log(data)
